import React from 'react'
import Home from './home'
class App extends React.Component {
    //1、构造方法
        // 通过给 this.state 赋值对象来初始化内部的state；

  constructor() {
  
    super()
    this.state = {
      message: '哈哈哈',
      isShowHome:true
    }
  }
  switchHomeShow(){
    this.setState({
       isShowHome:!this.state.isShowHome
    })
  }
  //2、执行render方法
  render() {
  
    const { message,isShowHome } = this.state
    return (
      <div>
        {message}
        <button onClick={()=>this.switchHomeShow()}>切换</button>
        {isShowHome&& <Home></Home>}
       
      </div>
    )
  }
}
export default App
